import React from "react";
import Cat from "../components/cat";

class Mousemove extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      x: 0,
      y: 0
    }
  }
  move = (e) => {
    this.setState({x: e.clientX, y: e.clientY})
  }
  render() {
    return (
      <div style={{
        height: '100vh'
      }} onMouseMove={this.move}>
        <h1>移动鼠标</h1>
        <p>当前鼠标的位置：({this.state.x}, {this.state.y})</p>
        <Cat mouse={{x:this.state.x, y:this.state.y}} render={mouse=>(<h2>{mouse.aaa}</h2>)}></Cat>
      </div>
    );
  }
}

export default Mousemove;